package com.adteam.xmap.manager.impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.adteam.xmap.entity.News;
import com.adteam.xmap.manager.NewsManager;

public class NewsManagerImpl extends HibernateDaoSupport implements NewsManager {

	public void addNews(News news) {

		getHibernateTemplate().save(news);
	}

	public void delNews(int id) {

		getHibernateTemplate().delete(findNewsById(id));
	}

	public List findAllNewses() {

		return getHibernateTemplate().find("select n from News n");
	}

	public News findNewsById(int id) {

		return (News)getHibernateTemplate().load(News.class, id);
	}

	public void updateNews(News news) {

		getHibernateTemplate().update(news);
	}

}
